package com.joysuch.wwyt.util;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;

/**
 * 雪花算法工具
 *
 * @Author ZhangDong
 * @Date 2020/12/22 9:22
 */
public class SnowFlakeUtil {

    /**
     * 明明：机器id，数据中心id   两边这两个参数保持不同即可避免重复； 化工两个参数在0，1，2之间取值
     */
    private static final Snowflake USER_ID_MAKER = IdUtil.getSnowflake(10, 10);
    private static final Snowflake DEPART_ID_MAKER = IdUtil.getSnowflake(11, 11);
    private static final Snowflake JOB_ID_MAKER = IdUtil.getSnowflake(12, 12);
    private static final Snowflake CONTRACTOR_ID_MAKER = IdUtil.getSnowflake(13, 13);
    private static final Snowflake CONTRACTOR_STAFF_ID_MAKER = IdUtil.getSnowflake(14, 14);
    private static final Snowflake IMAGE_ID_MAKER = IdUtil.getSnowflake(15, 15);
    private static final Snowflake WORKTYPE_ID_MAKER = IdUtil.getSnowflake(16, 16);
    private static final Snowflake TAG_ID_MAKER = IdUtil.getSnowflake(17, 17);
    private static final Snowflake CHECK_PLAN_MAKER = IdUtil.getSnowflake(18,18);
    private static final Snowflake ATTENDANCE_GROUP = IdUtil.getSnowflake(19, 19);

    /**
     * 获取人员自增uniqueId
     */
    public static String getUserId() {
        return String.valueOf(USER_ID_MAKER.nextId());
    }

    /**
     * 获取部门自增uniqueId
     */
    public static String getDepartId() {
        return String.valueOf(DEPART_ID_MAKER.nextId());
    }

    /**
     * 获取岗位自增uniqueId
     */
    public static String getJobId() {
        return String.valueOf(JOB_ID_MAKER.nextId());
    }

    /**
     * 获取承包商自增uniqueId
     */
    public static String getContractorId() {
        return String.valueOf(CONTRACTOR_ID_MAKER.nextId());
    }

    /**
     * 获取承包商人员自增uniqueId
     */
    public static String getContractorStaffId() {
        return String.valueOf(CONTRACTOR_STAFF_ID_MAKER.nextId());
    }

    /**
     * 获取图片自增uniqueId
     */
    public static String getImageId() {
        return String.valueOf(IMAGE_ID_MAKER.nextId());
    }

    public static Long getWorktypeId() {
        return WORKTYPE_ID_MAKER.nextId();
    }

    /**
     * 获取tag_id
     */
    public static Long getTagId() {
        return TAG_ID_MAKER.nextId();
    }

    /**
     * 获取巡检计划的自增uniqueId
     * @return
     */
    public static Long getCheckPlanId(){
        return CHECK_PLAN_MAKER.nextId();
    }

    /**
     * 获取考勤组id
     */
    public static String getAttenDanceGroupId() {
        return String.valueOf(ATTENDANCE_GROUP.nextId());
    }
}
